#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <aclconio.h>
#include <define.h>
#include <transact.h>
#include <tran.h>
#include <gds.h>
#include <sizes.h>
#include "ConfProto.h"
#include "tblutil.h"
#include <\SOFTPAY\Ver30\source\include\sizes.h>
#include <\SOFTPAY\Ver30\HostSrc\citisrc\citiids.h>
#include <\SOFTPAY\Ver30\HostSrc\cpacsrc\cpacids.h>
#include <confio.h>

#include <\SOFTPAY\Ver30\source\include\CPT.h>

const char*CPTName = "CPT.dat";

static CPT_REC srCPTRec;

static int recordNum;
int	inLoadCPTRec (int inRecNumber)
{
	int inRet;

	inRet = inLoadConfRec(CPT_FILENAME, SIZE_CPT_REC, inRecNumber, (char *) &srCPTRec);

	recordNum = inRecNumber;
	return inRet;
}

void *pvdGetCPTRec(void)
{
	return &srCPTRec;

}

int	inSaveCPTRec (int inRecNumber)
{
	int inRet;

	inRet = inSaveConfRec(CPT_FILENAME, SIZE_CPT_REC, inRecNumber, (char *) &srCPTRec);

	return inRet;
}

int	inGetCPTRecNumber (void)
{
	return recordNum;
}

int	inUpdateCPTRec (void)
{
	int inRet;

	inRet = inSaveConfRec(CPT_FILENAME, SIZE_CPT_REC, recordNum, (char *) &srCPTRec);

	return inRet;
}

void	vdResetCPTRec (void)
{
	memset((void*)&srCPTRec, 0, REC_SIZEOF(srCPTRec));
}

void vdGetCPTPriAuthPhoneNumber(char *pszParam, CPT_REC srCPTRec)
{
	strNumCopy(pszParam, srCPTRec.szPriAuthPhoneNumber, sizeof(srCPTRec.szPriAuthPhoneNumber));
}

void vdSetCPTPriAuthPhoneNumber(char* szPriAuthPhoneNumber, void *cptStruct)
{
	CPT_REC *srCPTRec = (CPT_REC*)cptStruct;

	strNumCopy(srCPTRec->szPriAuthPhoneNumber, szPriAuthPhoneNumber, sizeof(((CPT_REC*)NULL)->szPriAuthPhoneNumber)-1);;
}

void vdGetCPTSecAuthPhoneNumber(char *pszParam, CPT_REC srCPTRec)
{
	strNumCopy(pszParam, srCPTRec.szSecAuthPhoneNumber, sizeof(srCPTRec.szSecAuthPhoneNumber));
}

void vdSetCPTSecAuthPhoneNumber(char* szSecAuthPhoneNumber, void *cptStruct)
{
	CPT_REC *srCPTRec = (CPT_REC*)cptStruct;

	strNumCopy(srCPTRec->szSecAuthPhoneNumber, szSecAuthPhoneNumber, sizeof(((CPT_REC*)NULL)->szSecAuthPhoneNumber)-1);;
}

void vdGetCPTPriSettlePhoneNumber(char *pszParam, CPT_REC srCPTRec)
{
	strNumCopy(pszParam, srCPTRec.szPriSettlePhoneNumber, sizeof(srCPTRec.szPriSettlePhoneNumber));
}

void vdSetCPTPriSettlePhoneNumber(char* szPriSettlePhoneNumber, void *cptStruct)
{
	CPT_REC *srCPTRec = (CPT_REC*)cptStruct;

	strNumCopy(srCPTRec->szPriSettlePhoneNumber, szPriSettlePhoneNumber, sizeof(((CPT_REC*)NULL)->szPriSettlePhoneNumber)-1);;
}

void vdGetCPTSecSettlePhoneNumber(char *pszParam, CPT_REC srCPTRec)
{
	strNumCopy(pszParam, srCPTRec.szSecSettlePhoneNumber, sizeof(srCPTRec.szSecSettlePhoneNumber));
}

void vdSetCPTSecSettlePhoneNumber(char* szSecSettlePhoneNumber, void *cptStruct)
{
	CPT_REC *srCPTRec = (CPT_REC*)cptStruct;

	strNumCopy(srCPTRec->szSecSettlePhoneNumber, szSecSettlePhoneNumber, sizeof(((CPT_REC*)NULL)->szSecSettlePhoneNumber)-1);;
}

void vdGetCPTModemParam(char *pszParam, CPT_REC srCPTRec)
{
	strNumCopy(pszParam, srCPTRec.szModemParam, sizeof(srCPTRec.szModemParam));
}

void vdSetCPTModemParam(char* szModemParam, void *cptStruct)
{
	CPT_REC *srCPTRec = (CPT_REC*)cptStruct;

	strNumCopy(srCPTRec->szModemParam, szModemParam, sizeof(((CPT_REC*)NULL)->szModemParam)-1);;
}

void vdGetCPT3101HostAddr(char *pszParam, CPT_REC srCPTRec)
{
	strNumCopy(pszParam, srCPTRec.sz3101HostAddr, sizeof(srCPTRec.sz3101HostAddr));
}

void vdSetCPT3101HostAddr(char* sz3101HostAddr, void *cptStruct)
{
	CPT_REC *srCPTRec = (CPT_REC*)cptStruct;

	strNumCopy(srCPTRec->sz3101HostAddr, sz3101HostAddr, sizeof(((CPT_REC*)NULL)->sz3101HostAddr)-1);;
}

short shGetCPTModemMode(CPT_REC srCPTRec)
{
	return srCPTRec.shModemMode;;
}

void vdSetCPTModemMode(short shModemMode, void *cptStruct)
{
	CPT_REC *srCPTRec = (CPT_REC*)cptStruct;

	srCPTRec->shModemMode = shModemMode;;
}

short shGetCPTBaudRate(CPT_REC srCPTRec)
{
	return srCPTRec.shBaudRate;;
}

void vdSetCPTBaudRate(short shBaudRate, void *cptStruct)
{
	CPT_REC *srCPTRec = (CPT_REC*)cptStruct;

	srCPTRec->shBaudRate = shBaudRate;;
}

short shGetCPTDataFormat(CPT_REC srCPTRec)
{
	return srCPTRec.shDataFormat;;
}

void vdSetCPTDataFormat(short shDataFormat, void *cptStruct)
{
	CPT_REC *srCPTRec = (CPT_REC*)cptStruct;

	srCPTRec->shDataFormat = shDataFormat;;
}

short shGetCPTNumOfTries(CPT_REC srCPTRec)
{
	return srCPTRec.shNumOfTries;;
}

void vdSetCPTNumOfTries(short shNumOfTries, void *cptStruct)
{
	CPT_REC *srCPTRec = (CPT_REC*)cptStruct;

	srCPTRec->shNumOfTries = shNumOfTries;;
}

short shGetCPTCarrierTimeOut(CPT_REC srCPTRec)
{
	return srCPTRec.shCarrierTimeOut;;
}

void vdSetCPTCarrierTimeOut(short shCarrierTimeOut, void *cptStruct)
{
	CPT_REC *srCPTRec = (CPT_REC*)cptStruct;

	srCPTRec->shCarrierTimeOut = shCarrierTimeOut;;
}

short shGetCPTRespTimeOut(CPT_REC srCPTRec)
{
	return srCPTRec.shRespTimeOut;;
}

void vdSetCPTRespTimeOut(short shRespTimeOut, void *cptStruct)
{
	CPT_REC *srCPTRec = (CPT_REC*)cptStruct;

	srCPTRec->shRespTimeOut = shRespTimeOut;;
}

short shGetCPTInterCharTO(CPT_REC srCPTRec)
{
	return srCPTRec.shInterCharTO;;
}

void vdSetCPTInterCharTO(short shInterCharTO, void *cptStruct)
{
	CPT_REC *srCPTRec = (CPT_REC*)cptStruct;

	srCPTRec->shInterCharTO = shInterCharTO;;
}

short shGetCPTSyncSwitchDelay(CPT_REC srCPTRec)
{
	return srCPTRec.shSyncSwitchDelay;;
}

void vdSetCPTSyncSwitchDelay(short shSyncSwitchDelay, void *cptStruct)
{
	CPT_REC *srCPTRec = (CPT_REC*)cptStruct;

	srCPTRec->shSyncSwitchDelay = shSyncSwitchDelay;;
}

long lnGetCPTRedialDelay(CPT_REC srCPTRec)
{
	return srCPTRec.lnRedialDelay;;
}

void vdSetCPTRedialDelay(long lnRedialDelay, void *cptStruct)
{
	CPT_REC *srCPTRec = (CPT_REC*)cptStruct;

	srCPTRec->lnRedialDelay = lnRedialDelay;;
}

long lnGetCPTMultiTransDelay(CPT_REC srCPTRec)
{
	return srCPTRec.lnMultiTransDelay;;
}

void vdSetCPTMultiTransDelay(long lnMultiTransDelay, void *cptStruct)
{
	CPT_REC *srCPTRec = (CPT_REC*)cptStruct;

	srCPTRec->lnMultiTransDelay = lnMultiTransDelay;;
}

VS_BOOL fGetCPTReconnect(CPT_REC srCPTRec)
{
	return srCPTRec.fReconnect;;
}

void vdSetCPTReconnect(VS_BOOL fReconnect, void *cptStruct)
{
	CPT_REC *srCPTRec = (CPT_REC*)cptStruct;

	srCPTRec->fReconnect = fReconnect;;
}

VS_BOOL fGetCPTModemFastConnect(CPT_REC srCPTRec)
{
	return srCPTRec.fModemFastConnect;;
}

void vdSetCPTModemFastConnect(VS_BOOL fModemFastConnect, void *cptStruct)
{
	CPT_REC *srCPTRec = (CPT_REC*)cptStruct;

	srCPTRec->fModemFastConnect = fModemFastConnect;;
}

VS_BOOL fGetCPTCommType(CPT_REC srCPTRec)
{
	return srCPTRec.fCommType;;
}

void vdSetCPTCommType(VS_BOOL fCommType, void *cptStruct)
{
	CPT_REC *srCPTRec = (CPT_REC*)cptStruct;

	srCPTRec->fCommType = fCommType;;
}

VS_BOOL fGetCPTBlindDial(CPT_REC srCPTRec)
{
	return srCPTRec.fBlindDial;;
}

void vdSetCPTBlindDial(VS_BOOL fBlindDial, void *cptStruct)
{
	CPT_REC *srCPTRec = (CPT_REC*)cptStruct;

	srCPTRec->fBlindDial = fBlindDial;;
}

VS_BOOL fGetCPTDialType(CPT_REC srCPTRec)
{
	return srCPTRec.fDialType;;
}

void vdSetCPTDialType(VS_BOOL fDialType, void *cptStruct)
{
	CPT_REC *srCPTRec = (CPT_REC*)cptStruct;

	srCPTRec->fDialType = fDialType;;
}

VS_BOOL fGetCPT3101CommType(CPT_REC srCPTRec)
{
	return srCPTRec.f3101CommType;;
}

void vdSetCPT3101CommType(VS_BOOL f3101CommType, void *cptStruct)
{
	CPT_REC *srCPTRec = (CPT_REC*)cptStruct;

	srCPTRec->f3101CommType = f3101CommType;;
}

